/* -*-c++-*- */
/* osgGIS - GIS Library for OpenSceneGraph
 * Copyright 2007-2008 Glenn Waldron and Pelican Ventures, Inc.
 * http://osggis.org
 *
 * osgGIS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

#ifndef _OSGGIS_CHANGE_SHAPE_TYPE_FILTER_H_
#define _OSGGIS_CHANGE_SHAPE_TYPE_FILTER_H_ 1

#include <osgGIS/FeatureFilter>
#include <osgGIS/GeoShape>

namespace osgGIS
{
    /**
     * Changes the shape type of incoming features.
     *
     * Every feature has a shape type (one of the GeoShape::Type values). Since the
     * shape data itself is just a collection of points, you can opt to treat it as a
     * different shape type by using this filter.
     *
     * For example, use this filter to treat polygon data as line data if you
     * are just interested in rendering the polygon outlines.
     */
    class OSGGIS_EXPORT ChangeShapeTypeFilter : public FeatureFilter
    {  
        OSGGIS_META_FILTER( ChangeShapeTypeFilter );   

    public:
        /**
         * Constructs a new ChangeShapeType filter.
         */
        ChangeShapeTypeFilter();

        /**
         * Copy constructor.
         */
        ChangeShapeTypeFilter( const ChangeShapeTypeFilter& rhs );

        /**
         * Constructs a new filter that will change feature shape types
         * to the specified type.
         *
         * @param new_type
         *      Type to which to change incoming feature shapes.
         */
        ChangeShapeTypeFilter( const GeoShape::ShapeType& new_type );

    public: //properties

        /** 
         * Sets the shape type to which to change all feature shapes.
         * @param new_type
         *      Shape type of output features
         */
        void setNewShapeType( const GeoShape::ShapeType& new_type );

        /**
         * Gets the shape type that this filter will assign to incoming
         * feature shapes.
         *
         * @return
         *      Shape type of output features.
         */
        const GeoShape::ShapeType& getNewShapeType() const;


    public: // Filter properties
        virtual void setProperty( const Property& p );
        virtual Properties getProperties() const;

    public: // FeatureFilter properties
        virtual FeatureList process( Feature* input, FilterEnv* env );

        virtual ~ChangeShapeTypeFilter();

    private:
        GeoShape::ShapeType new_type;
    };
}


#endif // _OSGGIS_CHANGE_SHAPE_TYPE_FILTER_H_
